/* $Header: display.h,v 2.4 04/04/20 13:52:04 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:  display.h                                       */
/* ==================                                                  */
/*                                                                     */
/* Author:  Susan Merkel                                               */
/*                                                                     */
/* COMMENT:  This is the include file for display.c It contains        */
/*           the necessary prototypes for SetDisplayImage and          */
/*           SetNormalImage, and must be included when these functions */
/*           are used.                                                 */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/

#ifndef DISPLAY_H
#define DISPLAY_H

/*****************************/
/*   SYMBOLIC CONSTANTS      */
/*****************************/

/* defines used in display and message subsystems   */

#define DISPLAY_LENGTH       81
#define DISPLAY_WIDTH        20

/*****************************/
/*   MACROS                  */
/*****************************/


/*****************************/
/*   TYPEDEFS                */
/*****************************/


/*****************************/
/*   EXTERNALS               */
/*****************************/

extern  const BIT8 * const English_Table[];
extern  void    (* Monitor_Function) (void);
extern  void    (* Line_Function [4]) (LINE Line);
extern  LINE    Lines [4];
extern  U_INT8  Cursor_Line;
extern  U_INT8  ID_Line;
extern  U_INT8  Monitor_Clock;
extern  BIT8    Monitor_Done;
extern  BIT8    Number_Build_Active;
extern  BIT8    Blink_Cursor;
extern  BIT8    Error_Displayed;
extern  BIT8    Monitor_Lockout;

extern DISP_IMAGE Disp_Image;
extern const char Build_ID[];

/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/

/* Prototypes for output formatters/utilities */

/* msg_util.c */
BIT8 *MessageToString(U_INT16 msg_number);
void CheckForPopupDisplay(void);

/* formatter.c */
BIT8 *FormatDecimal(BIT8 *buffer, INT32 number, U_INT8 startloc,
                    U_INT8 width, U_INT8 scale);
BIT8 *FormatHexadecimal(U_INT32 num, BIT8 *string, U_INT8 width);

/* display.c */
void InitializeDisplay(void);
void InitializeDisplayParallel(void);
void DisplayRamString(BIT8 *ram_string, ...);
void TransferString(BIT8 *message, BIT8 *string, ...);
void TransferMsg(U_INT16 msg_number, BIT8 *string, ...);
void TransferMsgLeftJustify(U_INT16 msg_number, BIT8 *string, ...);

#pragma SECTION PROG = SysCode
void OutputCharToDisplay(void);
#pragma SECTION UNDO

/* The next 4 functions use U_INT32 params for the message number(s).  This
   is to silence a valid FlexeLint concern:  if the last fixed param were
   declared as U_INT16 it could undergo a default promotion to int that
   might cause the variable arguments to be accessed incorrectly. */

void DisplayRomMessage(U_INT32 msg, ...);
void DisplayMsgBriefly(U_INT32 msg, ...);
void DisplayTwoRomMessage(U_INT32 msg1, U_INT32 msg2, ...);
void DisplayFourRomMessage(U_INT32 msg1, U_INT32 msg2, U_INT32 msg3, U_INT32 msg4, ...);
void DisplayWarnings(U_INT32 msg, ...);
void DisplayShutdowns(U_INT32 msg, ...);
void DisplayErrors(U_INT32 msg, ...);
void DisplayRangeErrors(U_INT32 msg, ...);
void DisplayNonFatalErrors(U_INT32 msg, ...);

/* these are provided only for backward compatibility:  all new code
   should use TransferMsg exclusively */

#define TransferMsgOneNum TransferMsg
#define TransferMsgTwoNum TransferMsg

/* dispmon.c */
void StartMonitor (void (*fn)() );
void Start4LineMonitor (void);
void EnableRefresh (void);
void StopMonitor (void);
void HaltMonitor (void);
void PauseMonitor (void);
void ResumeMonitor (void);
void Monitor4Lines (void);
void Display4Lines(void);
void Only4Lines (void (*f0)(LINE a), void (*f1)(LINE b), void (*f2)(LINE c),
                 void (*f3)(LINE d), U_INT8 cursor);

#endif
